<template>
    <view class="main">
        <view class="swiper">
            <swiper class="swiper-list" indicator-dots indicator-color="#FFA500" indicator-active-color="#FFF" interval="5000" :autoplay="autoplay" :duration="duration" @change="swiperChange">
                <swiper-item v-for="(item, index) in swiperList" :key="index">
                    <view class="swiper-item">
                        <view class="swiper-item-img">
                            <image :src="item" mode="aspectFill"></image>
                        </view>
                    </view>
                </swiper-item>
            </swiper>
			<view class="jumpover" @tap="goHome()" >{{timeNumber}}秒 跳过</view>
        </view>
    </view>
</template>
<script>
export default {
    data() {
        return {
			timeNumber:3,
            titleNViewBackground: '',
            swiperCurrent: 0,
            swiperLength: 1,
            swiperList: [],
            autoplay: false,
            timer: null,
            duration: 500,
            jumpover: '跳过',
            experience: '立即体验'
        };
    },
    onLoad() {
		this.swiperList=['../../static/guid.png']
		let that=this
		this.timer=setInterval(()=>{
			that.timeNumber--
			if(that.timeNumber==0){
				clearInterval(that.timer)
				this.goHome()
			}
		},1000)
    },
    methods: {
		goHome() {
			clearInterval(this.timer)
			var loginToken = uni.getStorageSync('access_token');
			if (loginToken == '') {
				uni.reLaunch({
					url: '/pages/common/login'
				})
			} else {
				uni.switchTab({
					url: '/pages/index/index'
				})
			}
		},
        //轮播图切换修改背景色
        swiperChange(e) {
            const index = e.detail.current;
            this.swiperCurrent = index;
            this.swiperLength = this.swiperList.length;
        }
    }
};
</script>
<style>
page,
.main {
    width: 100%;
    height: 100%;
    padding: 0;
    background-size: 100% auto;
	background-color: #1658FF;
}

.swiper{
    flex-direction: column;
    width: 100%;
    height: 100%;
    background: #fff;
}

.swiper-list {
    width: 100%;
    height: 100%;
}

.swiper-item {
    position: relative;
    display: flex;
    align-items: center;
    flex-direction: column;
    width: 100%;
    height: 100%;
    text-align: center;
}

.swiper-item-img {
    justify-content: center;
    width: 100%;
    height: 100%;
    margin: 0 auto;
}

.swiper-item-img image {
    width: 100%;
    height: 100%;
}

.jumpover,
.experience {
    position: absolute;
    z-index: 999;
    height: 60rpx;
    line-height: 60rpx;
    padding: 0 40rpx;
    color: #fff;
    border: 2rpx solid #fff;
    border-radius: 30rpx;
	font-size:26rpx;
}

.jumpover {
    right: 30rpx;
    top: 120rpx;
}

.experience {
    right: 50%;
    bottom: 140rpx;
    margin-right: -116rpx;
}
</style>
